{use master_page('admin/v_master')} 
{block content}

<?php 
// print_r($title) ;exit ; 
?>
<?php $ci = &get_instance(); 
function bl_article_class($children,$level=1)
{
	$ci = & get_instance();
	foreach($children as $child)
	{
		$title = $child->title;
		$pad = "";
		if($level>1)
		{
			for($i=0;$i<$level-1;$i++)
			{
				$pad = $pad . "&nbsp;&nbsp;";
			}
			$pad = $pad."└";
		}
		if($level == 1){
			$pad="";
		}
		// $title = str_pad($title,'-',strlen($title)+level,STR_PAD_LEFT);

		echo "<option value='".$child->id."'>$pad$title</option>" ;
		if(sizeof($child->children)>0)
		{
			bl_article_class($child->children,$level+1);
		}
	}
}
?>

<form action="<?=$_SERVER['REQUEST_URI']?>" method="post"><div class="blank20" style="height:20px"></div>
<div id="tagscontent" class="right_box" >
	<table class="formtable" style="border:0px solid #cfcfcf;width:100%">
		<tr class='form_line'>
			<td class='title'><?=lang('article_class_title')?></td>
			<td class='content' width="60%">
				<input name='p_title' size='20' value='<?=set_value('p_title', $title)?>' type='text' />  
				<?=form_error('p_title', '<font color="red">', '</font>')?>  
			</td>
		</tr>
        <tr class='form_line'>
            <td class='title'><?=lang('article_class_alias')?></td>
            <td class='content' width="80%">
                <input name='p_alias' size='30' value='<?=set_value('p_alias',$alias)?>' type='text' />
                <?=form_error('p_alias', '<font color="red">', '</font>')?>
            </td>
        </tr>
        <tr class='form_line'>
            <td class='title'><?=lang('article_class_page_size')?></td>
            <td class='content' width="80%">
                <input name='p_page_size' size='30' value='<?=set_value('p_page_size',($page_size==0?12:$page_size))?>' type='text' />
                <?=form_error('p_page_size', '<font color="red">', '</font>')?>
            </td>
        </tr>
		<tr class='form_line'>
			<td class='title'><?=lang('article_class_parent')?></td>  
			<td class='content'>
				<select id="parent_id"  class='bind'> 
					<option value="">请选择</option>
					<?php 
					$acs = $this->article_class_manager->get_root_list();
					//print_r($acs);exit ; 
					foreach($acs as $ac)
					{
						echo "<option value='".$ac->id."'>$ac->title</option>" ;
						
						if(sizeof($ac->children)>0)
						{
							bl_article_class($ac->children,2);
						}
					}
					?>
				</select>
				<input name='p_parent_id' size='2' value='<?=set_value('p_parent_id',($parent_id=='')?(isset($_GET['parent_id'])?$_GET['parent_id']:0):$parent_id)?>' type='hidden' />  
				<?=form_error('p_parent_id', '<font color="red">', '</font>')?>  
			</td>
		</tr>
		<tr class='form_line'>
			<td class='title'><?=lang('article_class_part_template')?></td>  
			<td class='content'>
				<select id="part_template" class="bind">
					<option value="">请选择</option>
					<?php foreach($part_templates as $pt):?>
					<option value="{pt}">{pt}</option> 
					<?php endforeach;?>
				</select>
				<input name='p_part_template' size='2' value='<?=set_value('p_part_template',$part_template)?>' type='hidden' />  
				<?=form_error('p_part_template', '<font color="red">', '</font>')?>  
			</td>
		</tr>
	</table> 
	<div class="blank20"style="height:20px"></div>
	<!--input name ="p_article_class_name" value="<?php echo $this->input->get('name');?>" type="hidden"/-->	
	<input type="submit" name="submit" value=" 提交 " class="btn_a">
</div>
</form>
{end}